﻿using AnyTap.ViewModels;
namespace AnyTap.Views;

/// <summary>
/// 页面基类
/// </summary>
public abstract class BaseView : ContentPage
{
	private BaseViewModel ViewModel => BindingContext as BaseViewModel;

	protected override async void OnNavigatedTo(NavigatedToEventArgs args)
	{
		base.OnNavigatedTo(args);
		await ViewModel.OnAppearing();
	}

	protected override async void OnNavigatedFrom(NavigatedFromEventArgs args)
	{
		base.OnNavigatedFrom(args);
		await ViewModel.OnDisappearing();
	}

	protected override void OnDisappearing() => base.OnDisappearing();
}
